
import java.awt.*;
import javax.swing.*;
import javax.swing.border.Border;

/**
 * Top panel with add event and filter button. Also displays current month and
 * year.
 */
public class TopFilterPanel extends ObservingJPanel {

    protected JLabel title;
    protected JButton back;
    protected CalendarController controller;

    public TopFilterPanel(CalendarController controller, String titleString) {

        // Set looks of panel
        this.setBackground(new Color(228, 234, 239));
        this.setBorder(BorderFactory.createMatteBorder(0, 0, 2, 0, new Color(64, 75, 84)));
        this.setLayout(new BorderLayout());
        this.setPreferredSize(new Dimension(100, 40));

        // Set controller
        this.controller = controller;

        // Add and configure components
        back = new JButton("< Back");
        title = new JLabel(titleString);
        title.setBorder(BorderFactory.createEmptyBorder(0,10,0,0));

        back.addActionListener(controller.createBackEventListener());
        
        this.add(back, BorderLayout.WEST);
        this.add(title, BorderLayout.CENTER);

    }

    @Override
    public void update() {
        throw new UnsupportedOperationException("Not supported yet.");
    }
}
